<?php
	@header("Content-Type:text/html;charset=utf-8");
	@header("Access-Control-Allow-Origin:*");
	
	
	$conn =  mysql_connect("localhost","root","root");   
	$a = mysql_select_db("myobject",$conn);   //连接数据库
	
	
	$userid= $_GET["userid"];
	//  goodslist g
	//  shoppingcar s
	$sql = "select g.goods_id,g.goods_title,g.goods_current_price,s.buy_num,s.buy_account from goodslist as g, shoppingcar as s where s.goods_id = g.goods_id and s.user_id='$userid'";
//	echo $sql;
	mysql_query("set names utf8");     //数据库输入输出编码格式
	
	$result = mysql_query($sql);
	$arr = array(); 
	while($item = mysql_fetch_object($result)){
		$arr[] = $item;
	}

	echo json_encode($arr);
?>